package top.lcm889.juc.count_down_latch.demo2;

import java.util.concurrent.CountDownLatch;

/**
 * @author Coder-lcm
 * @date 2021/6/4
 */
public class MyThread2 extends Thread{
    private CountDownLatch latch;
    private String name;

    public MyThread2(CountDownLatch latch, String name){
        this.latch = latch;
        this.name = name;
    }

    @Override
    public void run() {
        try {
            System.out.println(name + " 服务员在等待人员到齐");
            latch.await();
            System.out.println(name + " 人员到齐，服务员开始上菜");
        }catch (Exception e) {
            e.printStackTrace();
        }
    }
}
